package com.yh.csx.bsf.flow.provider;

import com.yh.csx.business.api.entity.CommonResponse;
import com.yh.csx.business.api.entity.PageResponse;
import com.yh.csx.bsf.flow.provider.vo.TaskDetailVO;
import com.yh.csx.bsf.flow.provider.vo.TaskVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.Map;

@Api(value = "任务操作")
@FeignClient(value = "csx-bsf-flow-provider-rpc")
@RequestMapping(value = "/task")
public interface ITaskProvider {
    @ApiOperation("获取待办任务")
    @RequestMapping(value = "/waitingList")
    PageResponse<TaskVO> waitingList(@ApiParam("流程ID") Integer flowId,
                                     @ApiParam("任务ID") Integer Id,
                                     @ApiParam("标题") String title,
                                     @ApiParam("审批人") String approveBy,
                                     @ApiParam("审核人工号") String approveUserNo,
                                     @ApiParam("创建起始时间") String createTimeFrom,
                                     @ApiParam("创建截止时间") String createTimeEnd,
                                     @ApiParam("页码") Integer pageIndex,
                                     @ApiParam("页大小") Integer pageSize);

    @ApiOperation("获取已办任务")
    @RequestMapping(value = "/doneList")
    public PageResponse<TaskVO> doneList(@ApiParam("流程ID") Integer flowId,
                                         @ApiParam("任务ID") Integer Id,
                                         @ApiParam("标题") String title,
                                         @ApiParam("审批人") String approveBy,
                                         @ApiParam("审核人工号") String approveUserNo,
                                         @ApiParam("创建起始时间") String createTimeFrom,
                                         @ApiParam("创建截止时间") String createTimeEnd,
                                         @ApiParam("页码") Integer pageIndex,
                                         @ApiParam("页大小") Integer pageSize);

    @ApiOperation("任务详情")
    @RequestMapping(value = "/detail")
    public CommonResponse<TaskDetailVO> detail(@ApiParam("任务ID")  Integer taskId, @ApiParam("操作人工号") String userNo);

    @ApiOperation("审批提交")
    @RequestMapping(value="/approve", method = RequestMethod.POST)
    public CommonResponse<String> approve(@ApiParam("任务ID") Integer id, @ApiParam("审核结果") String approveResult, @ApiParam("备注") String remark, @ApiParam("变量") Map<String,String> variables, @ApiParam("操作人工号") String userNo) ;

    @ApiOperation("转交")
    @RequestMapping(value="/transfer", method = RequestMethod.POST)
    public CommonResponse<String> transfer(@ApiParam("任务ID") Integer id,@ApiParam("转交人工号") String transferUserNo,@ApiParam("操作人工号") String userNo);

}
